﻿using System;

namespace awsomeSyntezator.PipeLine.Envelopes
{
    class Tremolo : Envelope
    {
    	public int vibratoFrequency;
        public Tremolo(float _strengh) : base(_strengh)
        {
        	vibratoFrequency = 1;
        }
		public Tremolo(float _strengh, int freq): base(_strengh)
		{
			vibratoFrequency = freq;
		}
        
        public override double getSample(int n, double sample)
        {
            return sample * (((Math.Sin(n * Options.step * Math.PI * vibratoFrequency) + 1) / 2) + strengh) / (strengh + 1);   
        }
    }
}
